#pragma once

namespace bit
{
	template <class T,class Container=deque<T>>
	class Stack
	{
	public:
		void push(const T& x)
		{
			_con.push_back(x);
		}
		
		void pop(void)
		{
			_con.pop_back();
		}

		size_t size(void)
		{
			return _con.size();
		}

		T& top(void)
		{
			return _con.back();
		}

		bool empty()
		{
			return _con.empty();
		}
	private:
		Container _con;
	};

	void test_stack1(void)
	{
		Stack<int> s1;
		s1.push(1);
		s1.push(2);
		s1.push(3);
		s1.push(4);

		//size_t m = s1.size();
		//for (size_t i = 0; i < m; i++)
		while(!s1.empty())
		{
			cout << s1.top() << " ";
			s1.pop();
		}
		cout << endl;

		Stack<int, vector<int>> s2;
		s2.push(10);
		s2.push(20);
		s2.push(30);
		s2.push(40);
		while (!s2.empty())
		{
			cout << s2.top() << " ";
			s2.pop();
		}
		cout << endl;
	}
}